#ifndef __SYSTEM_H
#define __SYSTEM_H

#ifndef __SIZE_T
#define __SIZE_T
typedef unsigned int size_t;
#endif

/* MAIN.C */
extern void *memcpy(void *dest, const void *src, size_t count);
extern void *memset(void *dest, char val, size_t count);
extern unsigned short *memsetw(unsigned short *dest, unsigned short val, size_t count);
extern size_t strlen(const char *str);
extern unsigned char inportb (unsigned short _port);
extern void outportb (unsigned short _port, unsigned char _data);

/* SCREEN.C */

extern void setCursorPosition(short row, short col);
extern void clearScreen();
extern void putch(unsigned char c);
extern void puts(const char *str);
extern void setTextColor(unsigned char forecolor, unsigned char backcolor);
extern void init_video();

/* KEYBOARD.C */

//extern char getScanCode();
//extern WORD16 ScanCode2Ascii(BYTE8 code);

/* KB.C */
extern unsigned char kbdus[128];
extern void keyboard_install();

/* GDT.C */
extern void gdt_set_gate(int num, unsigned long base, unsigned long limit, unsigned char access, unsigned char gran);
extern void gdt_install();

/* IDT.C */
extern void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags);
extern void idt_install();

/* ISRS.C */
struct regs
{
	unsigned int gs, fs, es, ds;
	unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
	unsigned int int_no, err_code;
	unsigned int eip, cs, eflags, useresp, ss;
};
extern void isrs_install();

/* IRQ.C */
extern void irq_install();
extern void irq_install_handler(int irq, void (*handler)(struct regs *r));
extern void irq_uninstall_handler(int irq);
#endif
